if(!BXRS){var BXRS={};var BXRSW={}}Rating=function(t,e,i,n,u,s,o,p,l){this.enabled=true;this.voteId=t;this.entityTypeId=e;this.entityId=i;this.available=n=="Y"?true:false;this.userId=u;this.localize=s;this.template=o;this.light=o=="light"?true:false;this.pathToUserProfile=p;this.pathToAjax=typeof l=="string"?l:"/bitrix/components/bitrix/rating.vote/vote.ajax.php";this.box=o=="light"?BX("bx-rating-"+t):BX("rating-vote-"+t);if(this.box===null){this.enabled=false;return false}if(!this.light){this.buttonPlus=BX("rating-vote-"+t+"-plus");this.buttonMinus=BX("rating-vote-"+t+"-minus");this.result=BX("rating-vote-"+t+"-result")}else{this.buttonPlus=BX.findChild(this.box,{className:"bx-rating-yes"},true,false);this.buttonMinus=BX.findChild(this.box,{className:"bx-rating-no"},true,false);this.buttonPlusCount=BX.findChild(this.buttonPlus,{className:"bx-rating-yes-count"},true,false);this.buttonMinusCount=BX.findChild(this.buttonMinus,{className:"bx-rating-no-count"},true,false);this.buttonPlusText=BX.findChild(this.buttonPlus,{className:"bx-rating-yes-text"},true,false);this.buttonMinusText=BX.findChild(this.buttonMinus,{className:"bx-rating-no-text"},true,false);this.popupPlus=null;this.popupMinus=null;this.popupTimeoutId=null;this.popupContentPlus=BX.findChild(BX("bx-rating-popup-cont-"+t+"-plus"),{tagName:"span",className:"bx-ilike-popup"},true,false);this.popupContentMinus=BX.findChild(BX("bx-rating-popup-cont-"+t+"-minus"),{tagName:"span",className:"bx-ilike-popup"},true,false);this.popupContentPagePlus=1;this.popupContentPageMinus=1;this.popupListProcess=false;this.popupTimeout=false}this.voteProcess=false};Rating.Set=function(t,e,i,n,u,s,o,p,l){if(o===undefined)o="standart";if(!BXRS[t]||BXRS[t].tryToSet<=5){var a=BXRS[t]&&BXRS[t].tryToSet?BXRS[t].tryToSet:1;BXRS[t]=new Rating(t,e,i,n,u,s,o,p,l);if(BXRS[t].enabled){Rating.Init(t)}else{setTimeout(function(){BXRS[t].tryToSet=a+1;Rating.Set(t,e,i,n,u,s,o,p,l)},500)}}};Rating.Init=function(t){if(BXRS[t].available){BX.bind(BXRS[t].light?BXRS[t].buttonPlusText:BXRS[t].buttonPlus,"click",function(){if(BXRS[t].voteProcess)return false;BXRS[t].voteProcess=true;BX.addClass(BXRS[t].buttonPlus,BXRS[t].light?"bx-rating-load":"rating-vote-load");if(BX.hasClass(BXRS[t].buttonPlus,BXRS[t].light?"bx-rating-yes-active":"rating-vote-plus-active"))Rating.Vote(t,"plus","cancel");else Rating.Vote(t,"plus","plus");return false});BX.bind(BXRS[t].buttonPlus,"mouseover",function(){BX.addClass(this,BXRS[t].light?"bx-rating-hover":"rating-vote-hover")});BX.bind(BXRS[t].buttonPlus,"mouseout",function(){BX.removeClass(this,BXRS[t].light?"bx-rating-hover":"rating-vote-hover")});if(false&&BXRS[t].light){Rating.PopupScroll(t,"plus");BX.bind(BXRS[t].buttonPlus,"mouseover",function(){clearTimeout(BXRS[t].popupTimeoutId);BXRS[t].popupTimeoutId=setTimeout(function(){if(BXRSW["plus"]==t)return false;if(BXRS[t].popupContentPagePlus==1)Rating.List(t,1,"plus");BXRS[t].popupTimeoutId=setTimeout(function(){Rating.OpenWindow(t,"plus")},1e3)},400)});BX.bind(BXRS[t].buttonPlus,"mouseout",function(){clearTimeout(BXRS[t].popupTimeoutId);BXRS[t].popupTimeout=setTimeout(function(){if(BXRS[t].popupPlus!==null){BXRS[t].popupPlus.close();BXRSW["plus"]=null}},1e3)});BX.bind(BXRS[t].buttonPlusCount,"click",function(){clearTimeout(BXRS[t].popupTimeoutId);if(BXRS[t].popupContentPagePlus==1)Rating.List(t,1,"plus");Rating.OpenWindow(t,"plus")});BX.bind(BXRS[t].buttonPlusCount,"mouseover",function(){clearTimeout(BXRS[t].popupTimeout)});BX.bind(BXRS[t].buttonPlusText,"mouseover",function(){clearTimeout(BXRS[t].popupTimeout)})}BX.bind(BXRS[t].light?BXRS[t].buttonMinusText:BXRS[t].buttonMinus,"click",function(){if(BXRS[t].voteProcess)return false;BXRS[t].voteProcess=true;BX.addClass(BXRS[t].buttonMinus,BXRS[t].light?"bx-rating-load":"rating-vote-load");if(BX.hasClass(BXRS[t].buttonMinus,BXRS[t].light?"bx-rating-no-active":"rating-vote-minus-active")){Rating.Vote(t,"minus","cancel")}else{Rating.Vote(t,"minus","minus")}return false});BX.bind(BXRS[t].buttonMinus,"mouseover",function(){BX.addClass(this,BXRS[t].light?"bx-rating-hover":"rating-vote-hover")});BX.bind(BXRS[t].buttonMinus,"mouseout",function(){BX.removeClass(this,BXRS[t].light?"bx-rating-hover":"rating-vote-hover")});if(false&&BXRS[t].light){Rating.PopupScroll(t,"minus");BX.bind(BXRS[t].buttonMinus,"mouseover",function(){clearTimeout(BXRS[t].popupTimeoutId);BXRS[t].popupTimeoutId=setTimeout(function(){if(BXRSW["minus"]==t)return false;if(BXRS[t].popupContentPageMinus==1)Rating.List(t,1,"minus");BXRS[t].popupTimeoutId=setTimeout(function(){Rating.OpenWindow(t,"minus")},1e3)},400)});BX.bind(BXRS[t].buttonMinus,"mouseout",function(){clearTimeout(BXRS[t].popupTimeoutId);BXRS[t].popupTimeout=setTimeout(function(){if(BXRS[t].popupMinus!==null){BXRS[t].popupMinus.close();BXRSW["minus"]=null}},1e3)});BX.bind(BXRS[t].buttonMinusCount,"click",function(){clearTimeout(BXRS[t].popupTimeoutId);if(BXRS[t].popupContentPageMinus==1)Rating.List(t,1,"minus");Rating.OpenWindow(t,"minus")});BX.bind(BXRS[t].buttonMinusCount,"mouseover",function(){clearTimeout(BXRS[t].popupTimeout)});BX.bind(BXRS[t].buttonMinusText,"mouseover",function(){clearTimeout(BXRS[t].popupTimeout)})}}};Rating.UpdateStatus=function(t,e,i){BXRS[t].buttonPlus.title=i=="cancel"||e=="minus"?BXRS[t].localize["PLUS"]:BXRS[t].localize["CANCEL"];BXRS[t].buttonMinus.title=i=="cancel"||e=="plus"?BXRS[t].localize["MINUS"]:BXRS[t].localize["CANCEL"];BX.removeClass(BXRS[t].buttonPlus,BXRS[t].light?e=="plus"?"bx-rating-load":"bx-rating-yes-active":e=="plus"?"rating-vote-load":"rating-vote-plus-active");BX.removeClass(BXRS[t].buttonMinus,BXRS[t].light?e=="plus"?"bx-rating-no-active":"bx-rating-load":e=="plus"?"rating-vote-minus-active":"rating-vote-load");if(i=="cancel")BX.removeClass(e=="plus"?BXRS[t].buttonPlus:BXRS[t].buttonMinus,BXRS[t].light?"bx-rating-"+(e=="plus"?"yes":"no")+"-active":"rating-vote-"+e+"-active");else BX.addClass(e=="plus"?BXRS[t].buttonPlus:BXRS[t].buttonMinus,BXRS[t].light?"bx-rating-"+(e=="plus"?"yes":"no")+"-active":"rating-vote-"+e+"-active")};Rating.Vote=function(t,e,i){BX.ajax({url:BXRS[t].pathToAjax,method:"POST",dataType:"json",data:{RATING_VOTE:"Y",RATING_RESULT:"Y",RATING_VOTE_TYPE_ID:BXRS[t].entityTypeId,RATING_VOTE_ENTITY_ID:BXRS[t].entityId,RATING_VOTE_ACTION:i,sessid:BX.bitrix_sessid()},onsuccess:function(n){if(BXRS[t].light){BXRS[t].buttonPlusCount.innerHTML=n["resultPositiveVotes"];BXRS[t].buttonMinusCount.innerHTML=n["resultNegativeVotes"];if(n["action"]=="cancel")BX.removeClass(BXRS[t].box,"bx-rating-active");else BX.addClass(BXRS[t].box,"bx-rating-active")}else{BXRS[t].result.title=n["resultTitle"];BXRS[t].result.innerHTML=n["resultValue"];BX.removeClass(BXRS[t].result,n["resultStatus"]=="minus"?"rating-vote-result-plus":"rating-vote-result-minus");BX.addClass(BXRS[t].result,n["resultStatus"]=="minus"?"rating-vote-result-minus":"rating-vote-result-plus")}Rating.UpdateStatus(t,e,i);BXRS[t].voteProcess=false},onfailure:function(i){BX.removeClass(e=="minus"?BXRS[t].buttonMinus:BXRS[t].buttonPlus,BXRS[t].light?"bx-rating-load":"rating-vote-load")}});return false};Rating.OpenWindow=function(t,e){if(parseInt(e=="plus"?BXRS[t].buttonPlusCount.innerHTML:BXRS[t].buttonMinusCount.innerHTML)==0)return false;if((e=="plus"?BXRS[t].popupPlus:BXRS[t].popupMinus)==null){__popup=new BX.PopupWindow("rating-popup-"+t+"-"+e,e=="plus"?BXRS[t].buttonPlusCount:BXRS[t].buttonMinusCount,{content:BX("bx-rating-popup-cont-"+t+(e=="plus"?"-plus":"-minus")),lightShadow:true,autoHide:true,zIndex:2500});if(e=="plus")BXRS[t].popupPlus=__popup;else BXRS[t].popupMinus=__popup;BX.bind(BX("rating-popup-"+t+"-"+e),"mouseout",function(){clearTimeout(BXRS[t].popupTimeout);BXRS[t].popupTimeout=setTimeout(function(){if(e=="plus")BXRS[t].popupPlus.close();else BXRS[t].popupMinus.close();BXRSW[e]=null},1e3)});BX.bind(BX("rating-popup-"+t+"-"+e),"mouseover",function(){clearTimeout(BXRS[t].popupTimeout)})}else if(BX("rating-popup-"+t+"-"+e).style.display=="block"){if(e=="plus")BXRS[t].popupPlus.close();else BXRS[t].popupMinus.close();BXRSW[e]=null;return false}if(BXRSW["plus"]!=null){BXRS[BXRSW["plus"]].popupPlus.close();BXRSW["plus"]=null}if(BXRSW["minus"]!=null){BXRS[BXRSW["minus"]].popupMinus.close();BXRSW["minus"]=null}if(e=="plus")BXRS[t].popupPlus.show();else BXRS[t].popupMinus.show();BXRSW=t;if(e=="plus")BXRS[t].popupPlus.setAngle({position:"bottom"});else BXRS[t].popupMinus.setAngle({position:"bottom"});Rating.AdjustWindow(t,e)};Rating.List=function(t,e,i){if(parseInt(i=="plus"?BXRS[t].buttonPlusCount.innerHTML:BXRS[t].buttonMinusCount.innerHTML)==0)return false;if(e==null)e=i=="plus"?BXRS[t].popupContentPagePlus:BXRS[t].popupContentPageMinus;BXRS[t].popupListProcess=true;BX.ajax({url:BXRS[t].pathToAjax,method:"POST",dataType:"json",data:{RATING_VOTE_LIST:"Y",RATING_VOTE_LIST_TYPE:i,RATING_VOTE_TYPE_ID:BXRS[t].entityTypeId,RATING_VOTE_ENTITY_ID:BXRS[t].entityId,RATING_VOTE_LIST_PAGE:e,PATH_TO_USER_PROFILE:BXRS[t].pathToUserProfile,sessid:BX.bitrix_sessid()},onsuccess:function(n){if(parseInt(n.items_page)==0)return false;if(e==1){spanTag0=document.createElement("span");spanTag0.className="bx-ilike-bottom_scroll";if(i=="plus"){BXRS[t].popupContentPlus.innerHTML="";BXRS[t].popupContentPlus.appendChild(spanTag0)}else{BXRS[t].popupContentMinus.innerHTML="";BXRS[t].popupContentMinus.appendChild(spanTag0)}}if(i=="plus")BXRS[t].popupContentPagePlus+=1;else BXRS[t].popupContentPageMinus+=1;for(var u in n.items){aTag=document.createElement("a");aTag.className="bx-ilike-popup-img";aTag.href=n.items[u]["URL"];aTag.target="_blank";spanTag1=document.createElement("span");spanTag1.className="bx-ilike-popup-avatar";spanTag1.innerHTML=n.items[u]["PHOTO"];aTag.appendChild(spanTag1);spanTag2=document.createElement("span");spanTag2.className="bx-ilike-popup-name";spanTag2.appendChild(document.createTextNode(BX.util.htmlspecialcharsback(n.items[u]["FULL_NAME"])));aTag.appendChild(spanTag2);if(i=="plus")BXRS[t].popupContentPlus.appendChild(aTag);else BXRS[t].popupContentMinus.appendChild(aTag)}Rating.AdjustWindow(t,i);Rating.PopupScroll(t,i);BXRS[t].popupListProcess=false},onfailure:function(t){}});return false};Rating.AdjustWindow=function(t,e){children=BX.findChild(e=="plus"?BXRS[t].popupContentPlus:BXRS[t].popupContentMinus,{className:"bx-ilike-popup-img"},true,true);if(children!==null){iOffsetHeight=BX.browser.IsIE()?5:0;for(var i in children){iOffsetHeight+=children[i].offsetHeight}}else iOffsetHeight=BX.browser.IsIE()?35:30;if(iOffsetHeight<121)if(e=="plus")BXRS[t].popupContentPlus.style.height=iOffsetHeight+"px";else BXRS[t].popupContentMinus.style.height=iOffsetHeight+"px";else if(e=="plus")BXRS[t].popupContentPlus.style.height="121px";else BXRS[t].popupContentMinus.style.height="121px";var n=5;arScroll=BX.GetWindowScrollPos();if(e=="plus")iLeft=BXRS[t].popupPlus.bindElementPos.left-10;else iLeft=BXRS[t].popupMinus.bindElementPos.left-10;iLeftAngle=0;if(e=="plus")iWindow=iLeft+BXRS[t].popupPlus.popupContainer.offsetWidth;else iWindow=iLeft+BXRS[t].popupMinus.popupContainer.offsetWidth;iBody=document.body.clientWidth+arScroll.scrollLeft;if(iWindow>iBody){iLeft=iLeft-(iWindow-iBody);if(e=="plus")BXRS[t].popupPlus.setAngle({offset:iWindow-iBody+iLeftAngle});else BXRS[t].popupMinus.setAngle({offset:iWindow-iBody+iLeftAngle})}else if(iLeft<0){if(e=="plus")BXRS[t].popupPlus.setAngle({offset:iLeft+iLeftAngle});else BXRS[t].popupMinus.setAngle({offset:iLeft+iLeftAngle});iLeft=0}if(e=="plus")BX.adjust(BX("rating-popup-"+t+"-"+e),{style:{top:BXRS[t].popupPlus.bindElementPos.top-(BXRS[t].popupPlus.popupContainer.offsetHeight+n)+"px",left:iLeft+"px"}});else BX.adjust(BX("rating-popup-"+t+"-"+e),{style:{top:BXRS[t].popupMinus.bindElementPos.top-(BXRS[t].popupMinus.popupContainer.offsetHeight+n)+"px",left:iLeft+"px"}})};Rating.PopupScroll=function(t,e){BX.bind(e=="plus"?BXRS[t].popupContentPlus:BXRS[t].popupContentMinus,"scroll",function(){if(this.scrollTop>(this.scrollHeight-this.offsetHeight)/1.5){Rating.List(t,null,e);BX.unbindAll(this)}})};
//# sourceMappingURL=rating.map.js